<%-- 
    Document   : categoria_editar
    Created on : 05/06/2014, 13:43:44
    Author     : ebastos
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script src="//code.jquery.com/jquery-1.10.2.js"></script>
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Editar Categoria</h1>
        <form action="controladora?action=subcategoria" method="POST">
            <table>
                <tr>
                    <td>
                        Nome:
                    </td>
                    <td>
                        <input type="text" name="txtNome" value="${categoria.nome}" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Categoria Pai:
                    </td>
                    <td>
                        <select name="ddbCategoriaPai">
                            <c:forEach items="${requestScope.categorias}" var="fetch_categoria">
                                <option value="${fetch_categoria.ID}" <c:out value="${fetch_categoria.ID == categoria.categoria_pai ? 'selected' : ''}" /> >
                                    ${fetch_categoria.nome}
                                </option>
                            </c:forEach>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="submit" name="btnEditarCategoria" class="btnEditarCategoria" value="${categoria.ID}" hidden="hidden" />
                        <input type="submit" name="btnEditarVisivel" value="Editar" onclick="$('.btnEditarCategoria').click(); return false;" />
                    </td>
                    <td>
                        <input type="submit" value="Voltar" onclick="window.history.back();" />
                    </td>
                </tr>
            </table>
        </form>
    </body>
</html>
